﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Threading;

namespace Server
{
    class Program
    {
        static void Main(string[] args)
        {
            Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPHostEntry ipHostEntry = Dns.GetHostEntry(Dns.GetHostName());
            //IPEndPoint serverInfo = new IPEndPoint(ipHostEntry.AddressList[2], 9090);
            IPEndPoint serverInfo = new IPEndPoint(ipHostEntry.AddressList[1], 9090);
            serverSocket.Bind(serverInfo);
            serverSocket.Listen(10);
            SocketHelper sh = new SocketHelper();
            Thread thread = new Thread(sh.CreateSocket);
            thread.Start(serverSocket);
            Console.WriteLine("服务启动……");
        }
    }
}
